﻿@using IBS.Model
@using CommonApp;
@model IEnumerable<IBS.Model.Transfer>
@{
    ViewBag.Title = "Statement";
    Layout = "~/Views/Shared/_Cards_Menu.cshtml";
}
<h2>
    Statement</h2>

@Html.Partial("_Filter", "#cardForm")
@{
    var grid = new WebGrid(
        rowsPerPage: 10,
        canSort:false);
    grid.PageIndex = ViewBag.CurrentPage - 1;
    grid.Bind(Model, null, autoSortAndPage: false, rowCount: ViewBag.TotalRecordsCount);
}
@if (Model.Count() > 0)
{
@grid.GetHtml(
    tableStyle: "grid",
    headerStyle: "header",
    rowStyle: "row",
    footerStyle: "footer",
    alternatingRowStyle: "row",
    columns: grid.Columns(
            grid.Column("Operation Type", format:a=>(TransferType) a.TransferType),
            grid.Column("StartDate", "StartDate", style: "textCol"),
        grid.Column("EndDate", "EndDate", style: "textCol"),
                grid.Column("From Account", format: a => a.FromAccount.Number),
        grid.Column("FromAccountAmount", "Withdraw", style: "numCol"),
                //grid.Column("From Card", format: a =>( )a.FromCard.Number),
        grid.Column("ToAccount.Number", "ToAccount", style: "textCol"),
            //grid.Column("To Card", format: a =>DynamicHelper.Exists(a, "ToCard") ? "" : a.FromCard.Number),
        grid.Column("ToAccountAmount", "Deposit", style: "numCol"),
        grid.Column("Status", format: a=> (TransferStatus)a.Status, style: "textCol"),
             grid.Column("Bill", format: (item) =>
                                Html.ActionLink("Get Bill", "GetBill", "Bill", new { transferId = item.Id }, null)
                        )
    ))
}
else
{
    <label>
        No information available
    </label>   
}